/**
 * Created by Limit on 2017/8/28.
 */

var selected=[];

function addItem(id) {
    removeItem(id);
    selected.push(id);
    console.log(getSelected());
}

function removeItem(id) {

    for(var i=0;i<selected.length;i++){
        if(id===selected[i]){
            selected.splice(i,1);
            break;
        }
    }
    console.log(getSelected());
}

function getSelected() {

    return selected;
}

function clearSelected() {
    selected=[];
}